<template>
  <div
    class="item-container techExpert-container cursor-pointer"
    @click="toDetail"
  >
    <div class="head">
      <!-- <el-avatar :src="objInfo.picture"></el-avatar> -->
      <div class="addInfo">
        <div class="title">
          {{ objInfo.name }}
        </div>
        <div class="sub-title">
          {{ objInfo.diploma }}
        </div>
      </div>
    </div>
    <ul class="info-list">
      <li>
        <span class="label"> 专业 </span>
        {{ objInfo.specialty }}
      </li>

      <li>
        <span class="label"> 单位 </span>
        {{ objInfo.unitName }}
      </li>

      <li>
        <span class="label"> 所属领域 </span>
        {{ filedDictName(objInfo.domainId) }}
      </li>
      <li>
        <span class="label"> 地区 </span>
        {{ objInfo.location }}
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  name: 'TechExpertItem',
  props: {
    objInfo: {
      type: Object,
      default: () => {
        return {
          name: '',
          sex: '1',
          nativePlace: '',
          birthTime: '',
          phone: '',
          diploma: '',
          graduateSchool: '',
          domainId: '',
          professionalTitle: '',
          reviewExpertMembers: '1',
          unitName: '',
          office: '',
          unitType: '',
          address: '',
          resumeContent: '',
          fileArr: [],
        }
      },
    },
  },
  data() {
    return {
      // 行业类型
      positionDictName: 'user_common_field',
      positionList: [],
      detailRouteName: '/techSource/expertBase/expertBaseDetail/',
    }
  },
  computed: {
    filedDictName() {
      return (fileValue) => {
        let findItem = {}
        findItem = this.positionList.find(
          (item) => parseInt(item.dictValue) === parseInt(fileValue)
        )
        if (findItem) {
          return findItem['dictLabel'] ? findItem['dictLabel'] : '无'
        }
        return '无'
      }
    },
  },
  created() {
    this.initDictList()
  },
  methods: {
    toDetail() {
      let id = parseInt(this.objInfo.id)
      if (!id && id !== 0) {
        this.$message({
          type: 'error',
          message: '无效id',
        })
        return
      }
      this.$router.push({
        path: this.detailRouteName + id,
      })
    },
    initDictList() {
      this.getDictList(this.positionDictName).then((res) => {
        if (res.code == 200) {
          this.positionList = res.data
        }
      })
    },
  },
}
</script>

<style lang="scss" scoped>
.techExpert-container {
  padding: 24px;
  border-radius: 0;
  min-height: 375px;
  background-color: #ffffff;
  .head {
    display: flex;
    align-items: center;
    margin-bottom: 32px;
    .el-avatar {
      width: 110px;
      height: 110px;
    }
    .addInfo {
      font-size: 2rem;
      .title {
        font-family: Source Han Sans CN, Source Han Sans CN-Bold;
        font-weight: 700;
        text-align: left;
        color: #333333;
      }
      .sub-title {
        font-size: 14px;
        font-family: Source Han Sans CN, Source Han Sans CN-Regular;
        font-weight: 400;
        text-align: left;
        color: #1678ff;
      }
    }
  }

  .info-list {
    list-style: none;
    font-size: 14px;
    font-family: Source Han Sans CN, Source Han Sans CN-Regular;
    font-weight: 400;
    color: #999999;
    margin-bottom: 30px;
    li {
      height: 2rem;
      line-height: 2rem;

      span {
        display: inline-block;
      }
    }
    .label {
      min-width: 5rem;
    }
  }
}
</style>
